<template>
    <div class="layerRtb layerRtb-threecolumn">
        <three-title :title="{name:'实力'}"></three-title>
        <div class="layerRtb-scroll thinScroll" v-scrollHeight="437">
            <div class="analyItem">
                <p class="analyItemTit tx-center">实力</p>
                <div class="analyItemCon" v-if="flg==1">
               <p class="col-md-4">行业经验：<span class="cLightGray pr8">{{selectPmUserInfoList.worker_year ? selectPmUserInfoList.worker_year : ''}}</span></p >
                <p class="col-md-4">固定工人：<span class="cLightGray pr8">{{selectPmUserInfoList.worker_number ? selectPmUserInfoList.worker_number : ''}}</span></p >
                <p class="fl col-md-4">
                    <span class="cLightGray pr8" style="width: 76px;">工种</span><span>
                                <select v-model="self_job" class="widthB60" id="self_job3" disabled="disabled">
                                        <option ng-repeat="li in gongzhong" value="0" class="ng-binding ng-scope">请选择工种</option>
                                        <option ng-repeat="li in gongzhong" value="1" class="ng-binding ng-scope">瓦工</option>
                                        <option ng-repeat="li in gongzhong" value="2" class="ng-binding ng-scope">木工</option>
                                        <option ng-repeat="li in gongzhong" value="3" class="ng-binding ng-scope">油工</option>
                                        <option ng-repeat="li in gongzhong" value="4" class="ng-binding ng-scope">电工</option>
                                        <option ng-repeat="li in gongzhong" value="5" class="ng-binding ng-scope">暖通</option>
                                        <option ng-repeat="li in gongzhong" value="6" class="ng-binding ng-scope">焊工</option>
                                        <option ng-repeat="li in gongzhong" value="7" class="ng-binding ng-scope">壮工</option>
                                        <option ng-repeat="li in gongzhong" value="8" class="ng-binding ng-scope">安装</option>
                                        <option ng-repeat="li in gongzhong" value="9" class="ng-binding ng-scope">拆除</option>
                                        <option ng-repeat="li in gongzhong" value="10" class="ng-binding ng-scope">搬运</option>
                                        <option ng-repeat="li in gongzhong" value="11" class="ng-binding ng-scope">家具</option>
                                        <option ng-repeat="li in gongzhong" value="12" class="ng-binding ng-scope">弱电</option>
                                        <option ng-repeat="li in gongzhong" value="13" class="ng-binding ng-scope">水暖成品安装</option>
                                        <option ng-repeat="li in gongzhong" value="14" class="ng-binding ng-scope">电气成品安装</option>
                                        <option ng-repeat="li in gongzhong" value="88" class="ng-binding ng-scope">装饰成品安装</option>
                                        <option ng-repeat="li in gongzhong" value="100" class="ng-binding ng-scope">其他</option>
                                        <option ng-repeat="li in gongzhong" value="15" class="ng-binding ng-scope">水工</option>
                                        <option ng-repeat="li in gongzhong" value="16" class="ng-binding ng-scope">经理</option>
                                        <!-- <option ng-repeat="li in gongzhong" value="0" class="ng-binding ng-scope">监理</option> -->
                                </select>
                    </span>
                </p>
                    <div class="imgbox imgbox1 col-md-3" style="margin-top: 15px;">
                        <img src="https://gnr.rxjy.com/hrms/static/modules/cur/images/edit_img.png" title="编辑" width="20" class="fr pointer mr5" @click="flg=0">
                    </div>
                </div>
                <div class="analyItemCon" v-else>
                        <div class="textBoxtxt hide" style="display: block;">
                                        <p class="col-md-5">
                                            <span class="cLightGray pr8">行业经验</span>
                                            <input v-model="worker_year" type="text" class="width60 evaluateStandard" name="set_userInfo_u_jyshijian" > 年
                                        </p>
                                        <p class="col-md-5">
                                            <span class="cLightGray pr8">固定工人</span>
                                            <input v-model="worker_number"  type="text" class="width60 evaluateStandard" name="set_userInfo_u_worker" > 人
                                        </p>
                                        <p class="fl col-md-6" style="line-height: 45px;">
                                            <span  class="cLightGray pr8" style="width: 76px;">工种</span><span>
                                                    <select v-model="self_job" class="widthB60" id="self_job2">
                                                        <option ng-repeat="li in gongzhong" value="0" class="ng-binding ng-scope">请选择工种</option>
                                                        <option ng-repeat="li in gongzhong" value="1" class="ng-binding ng-scope">瓦工</option>
                                                        <option ng-repeat="li in gongzhong" value="2" class="ng-binding ng-scope">木工</option>
                                                        <option ng-repeat="li in gongzhong" value="3" class="ng-binding ng-scope">油工</option>
                                                        <option ng-repeat="li in gongzhong" value="4" class="ng-binding ng-scope">电工</option>
                                                        <option ng-repeat="li in gongzhong" value="5" class="ng-binding ng-scope">暖通</option>
                                                        <option ng-repeat="li in gongzhong" value="6" class="ng-binding ng-scope">焊工</option>
                                                        <option ng-repeat="li in gongzhong" value="7" class="ng-binding ng-scope">壮工</option>
                                                        <option ng-repeat="li in gongzhong" value="8" class="ng-binding ng-scope">安装</option>
                                                        <option ng-repeat="li in gongzhong" value="9" class="ng-binding ng-scope">拆除</option>
                                                        <option ng-repeat="li in gongzhong" value="10" class="ng-binding ng-scope">搬运</option>
                                                        <option ng-repeat="li in gongzhong" value="11" class="ng-binding ng-scope">家具</option>
                                                        <option ng-repeat="li in gongzhong" value="12" class="ng-binding ng-scope">弱电</option>
                                                        <option ng-repeat="li in gongzhong" value="13" class="ng-binding ng-scope">水暖成品安装</option>
                                                        <option ng-repeat="li in gongzhong" value="14" class="ng-binding ng-scope">电气成品安装</option>
                                                        <option ng-repeat="li in gongzhong" value="88" class="ng-binding ng-scope">装饰成品安装</option>
                                                        <option ng-repeat="li in gongzhong" value="100" class="ng-binding ng-scope">其他</option>
                                                        <option ng-repeat="li in gongzhong" value="15" class="ng-binding ng-scope">水工</option>
                                                        <option ng-repeat="li in gongzhong" value="16" class="ng-binding ng-scope">经理</option>
                                                        <!-- <option ng-repeat="li in gongzhong" value="0" class="ng-binding ng-scope">监理</option> -->
                                                    </select>
                                            </span>
                                        </p>
                            </div>
                        <div class="imgbox imgbox2 " style="margin-top: 15px;margin-right: -10px">
                            <img @click='updUserInfoNew' src="https://gnr.rxjy.com/hrms/static/modules/cur/images/save_img.png" title="保存" width="20" class="fl pointer mr5" name="update_stage_info_intention" onclick="saveThis(this)">
                            <img src="https://gnr.rxjy.com/hrms/static/modules/cur/images/goback_img.png" title="返回" width="20" class="fl pointer mr5" @click="flg=1">
                        </div>
                </div>
                </div>

            </div>
        <div class="layerRtb-footer">
              <div class="analyItem">
                <p class="analyItemTit tx-center">综合</p>
                <div class="analyItemCon">
                </div>
            </div>
        </div>
          <transition-group class="animated faster" enter-active-class="animated faster slideInRight" leave-active-class="animated faster slideOutRight">
         </transition-group>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { updUserInfoNew, updatePmUserInfoManager } from '../../Resources/Api/index'
export default {
    components: {
    },
    data () {
        return {
            flg: 1,
            selectPmUserInfoList: {},
            worker_year: 0, // 工作年限
            worker_number: 0, // 固定工人
            self_job: 0 // 工种
        }
    },
    created () {
        this.selectPmUserInfoList = this.$route.query.selectPmUserInfoList
        this.worker_year = this.selectPmUserInfoList.worker_year
        this.worker_number = this.selectPmUserInfoList.worker_number
        this.self_job = this.selectPmUserInfoList.self_job
    },
    methods: {
        updUserInfoNew () {
            if (this.worker_number === null || this.worker_number === '') {
                layer.msg('请输入固定工人')
            }
            if (this.worker_year === null || this.worker_year === '') {
                layer.msg('请输入工龄')
            }
            updUserInfoNew({
                uid: this.leftInfo.uid,
                workerNumber: this.worker_number,
                workerYear: this.worker_year
            }).then(res => {
                if (res.data.StatusCode === 0) {
                    this.updatePmUserInfoManager()
                    //     uid: this.leftInfo.uid,
                    //     selfJob: this.selfJob
                    // }).then(result => {
                    //     if (result.data.StatusCode === 0) {
                    //         layer.msg('更新成功')
                    //         this.$router.push(this.$route.matched[1].path)
                    //         // this.selectPmUserInfoList.workerNumber = this.number
                    //         // this.selectPmUserInfoList.workerYear = this.year
                    //     }
                    // })
                }
            }).catch(err => {
                console.log(err)
            })
        },
        updatePmUserInfoManager () {
            if (this.self_job === null || this.self_job === '') {
                layer.msg('请选择工种')
                return
            }
            updatePmUserInfoManager({
                uid: this.leftInfo.uid,
                selfJob: this.self_job
            }).then(result => {
                if (result.data.StatusCode === 0) {
                    layer.msg('更新成功')
                    this.$router.push(this.$route.matched[1].path)
                    // this.selectPmUserInfoList.workerNumber = this.number
                    // this.selectPmUserInfoList.workerYear = this.year
                }
            })
        }
    },
    computed: {
        ...mapGetters(['leftInfo'])
    },
    watch: {
    }
}

</script>
<style  scoped>
    .imgbox {
    position: absolute;
    right: 10px;
    top: 10px;
}
</style>
